<template>
  <div class="hello">
    <h1 @click="$parent.$emit('mua')">{{ msg }}</h1>
<!--  爷孙隔代传值  -->
    <Son></Son>
  </div>
</template>

<script>
import Son from '@/components/Son'
export default {
  name: 'HelloWorld',
  components: {
    Son
  },
  props: {
    msg: String
  },
  created () {
    this.$parent.$on('sayHey', () => {
      console.log('sayHey')
    })
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
</style>
